{% extends 'admin-v2/teach/open-course-analysis/layout.html.twig' %}

{% set nav = 'conversion' %}
{% block analysis_content %}

  <table class="table table-striped table-hover" id="course-table" style="word-break:break-all;">
    <thead>
      <tr>
          <th width="35%">{{ 'admin.open_manage.analysis.conversion.name_th'|trans }}</th>
          <th width="35%">{{ 'admin.open_manage.analysis.conversion.buy_num_th'|trans }}</th>
          <th>{{ 'admin.open_manage.analysis.conversion.visit_num_th'|trans }}</th>
          <th>{{ 'admin.open_manage.analysis.conversion.buy_rate_th'|trans }}</th>
          <th>{{ 'admin.open_manage.analysis.conversion.detail_th'|trans }}</th>
      </tr>
    </thead>
    <tbody>
      {% for refererLog in refererLogs %}
        {% set course = courses[refererLog.targetId]|default(null) %}
        {% include 'admin-v2/teach/open-course-analysis/conversion/table-tr.html.twig' %}
      {% else %}
        <tr>
          <td colspan="20">
            <div class="empty">{{ 'admin.open_manage.analysis.conversion.empty'|trans }}</div>
          </td>
        </tr>
      {% endfor %}
    </tbody>
  </table>
  <span>{{ 'admin.open_manage.analysis.footer_tips'|trans }}</span>
  <div>
    {{ 'admin.open_manage.analysis.conversion.total_buy_conversion_rate'|trans }}：
    {% if totalData.orderCount and totalData.visitCount %}
      {{ (totalData.orderCount / totalData.visitCount * 100 )|number_format(2,'.') }} %
    {% else %}
      0 %
    {% endif %}
  </div>

  {{ admin_macro.paginator(paginator) }}
{% endblock %}
